package jp.bgbt.fles.app.rnmodule;

import android.util.Log;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.common.utils.LogUtil;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;

public class ToastModule extends ReactContextBaseJavaModule {

    private static final String TAG = "ToastModule";
    private ReactApplicationContext mContext;
    @NonNull
    @Override
    public String getName() {
        return "ToastModule";
    }

    public ToastModule(@Nullable ReactApplicationContext reactContext) {
        super(reactContext);
        mContext = reactContext;
    }

    @ReactMethod
    public void show(String message, int duration) {
        LogUtil.d("show");
        Log.d(TAG,"--show");
        Toast.makeText(mContext, message, duration).show();
    }
}
